<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	/*******main*******/
	//攻略
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'ishot'=>1);
	$return['hotlist']=pdo_getall('jy_tour_spot',$params,array('title','id'));
	foreach($return['hotlist'] as &$v){
		$v['images']=json_decode($v['images'],true);
		$v['thumb']=tomedia($v['images'][0]);
	}
	$return['list']=array();
	set_html('title','攻略首页');
	exi($return);
}
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	if(!empty($_RQ['keyword'])){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
		$return['params']['keyword']=trim($_RQ['keyword']);
	}
    $orderby='createtime desc';
	$total='';
	$return['list']=pdo_getslice('jy_tour_strategy',$params,array($pindex,$psize),$total,$fields,'',$orderby);	
	foreach($return['list'] as &$item){
		$item['image']=tomedia($item['image']);
		$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
	}
	exi($return);
}